<%@page language="Java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="includes/head.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Transaction</title>
</head>
<body>
	<span id="whole-page-wrapper">
			<div id="wrapper" align="center">
			<%@include file="includes/header.jsp" %>
			<%@include file="includes/menu.jsp" %>	
					
				<div id="content">
					<div id="inner-content">
					<c:if test="${sessionScope.user.type == 'Admin' }">
						<h3>Szczegółowe dane telefonu</h3>
						
							<div class="leftIndent50px">
								<h4> ID zamówienia: </h4>
									<span class="leftIndent30px">${sessionScope.orders[param.id].id}</span><br>
								<h4> Data: </h4>
									<span class="leftIndent30px">${sessionScope.orders[param.id].date}</span><br>
								<h4> Status: </h4>
									<span class="leftIndent30px">
										<c:if test="${sessionScope.orders[param.id].status == 'Waiting'}">
											Oczekujące
										</c:if>
										<c:if test="${sessionScope.orders[param.id].status == 'In progress'}">
											W doręczeniu
										</c:if>
										<c:if test="${sessionScope.orders[param.id].status == 'Finished'}">
											Zrealizowane
										</c:if>
									</span><br>
								<h4> Ilość produktów: </h4>
									<span class="leftIndent30px">${sessionScope.orders[param.id].phones.size()}</span><br>
								<c:if test="${sessionScope.user.type == 'Admin' }">
									<form action="updateOrderStatus" method="POST">
										<h3> Oznacz zamówienie jako: </h3>
										<select name="status">
											<option value="Waiting"> Oczekujące </option>
											<option value="In progress"> W doręczeniu </option>
											<option value="Finished"> Zrealizowane </option>
										</select>
										<input type="hidden" name="orderID" value="${sessionScope.orders[param.id].id}" />
										<input type="submit" value="Aktualizuj" /> 
									</form>
								</c:if>
							</div>
					</c:if>
					<c:if test="${sessionScope.user.type == 'User' }">
						<h3>Szczegółowe dane telefonu</h3>
						
							<div class="leftIndent50px">
								<h4> ID zamówienia: </h4>
									<span class="leftIndent30px">${sessionScope.user_orders[param.id].id}</span><br>
								<h4> Data: </h4>
									<span class="leftIndent30px">${sessionScope.user_orders[param.id].date}</span><br>
								<h4> Status: </h4>
									<span class="leftIndent30px">
										<c:if test="${sessionScope.user_orders[param.id].status == 'Waiting'}">
											Oczekujące
										</c:if>
										<c:if test="${sessionScope.user_orders[param.id].status == 'In progress'}">
											W doręczeniu
										</c:if>
										<c:if test="${sessionScope.user_orders[param.id].status == 'Finished'}">
											Zrealizowane
										</c:if>
									</span><br>
								<h4> Ilość produktów: </h4>
									<span class="leftIndent30px">${sessionScope.user_orders[param.id].phones.size()}</span><br>
							</div>
					</c:if>
					<c:if test="${sessionScope.user == null }">
						Nie masz uprawnień do korzystania z tej strony!
					</c:if>	
					</div>
				</div>
				<%@include file="includes/footer.jsp" %>
			</div>
		</span>
</body>
</html>